package com.zjy.health_ms.controller;

import com.zjy.health_ms.entity.Result;
import com.zjy.health_ms.utils.JWTUtil;
import io.jsonwebtoken.Claims;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Objects;

/**
 * @program: health_ms
 * @ClassName SystemController
 * @description:
 * @author: Ats
 * @create: 2025-05-12 15:59
 * @Version 1.0
 */

@RestController
@RequestMapping("/system")
public class SystemController {

    @GetMapping("/isToken")
    public Result isTokenEffective(String token) {
        Claims claims = JWTUtil.checkJWT(token);
        return Objects.isNull(claims) ? Result.buildFail() : Result.buildSuccess(claims);
    }

}
